package controller;

import cn.dsna.util.images.ValidateCode;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet(name = "ValidateCodeCtrl", value = "/ValidateCodeCtrl")
public class ValidateCodeCtrl extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        ValidateCode validateCode =new ValidateCode(200,30,4,20);
        String codes = validateCode.getCode();
        System.out.println("codes");
        HttpSession session = request.getSession();
        session.setAttribute("codes",codes);
        validateCode.write(response.getOutputStream());
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
